/*
 * GET home page.
 */
var url = require("url");

exports.index = function(req, res) {
	// res.render('index', { title: 'Express' })
	if(req.session.name) {
		res.sendfile("./index.html");
	} else {
		res.redirect("/loginUserForm");
	}

};
exports.registerUserForm = function(req, res) {
	res.sendfile("./registerUser.html");
}

exports.loginUserForm = function(req, res) {
	res.sendfile("./loginUser.html");
}
exports.sendFilesNoSession = function(req, res) {
	var pathname = url.parse(req.url).pathname;
	// console.log(url.parse(req.url).pathname+" is sent");
	res.sendfile("." + pathname);
};
//
// exports.cssLogin= function(req, res) {
// res.sendfile("./Styles/pageLayout2.css");
// }
exports.sendFiles = function(req, res) {
	// res.render('index', { title: 'Express' })
	// console.log(url.parse(req.url).pathname+" is sent");

	if(req.session.name) {
		var pathname = url.parse(req.url).pathname;
		// console.log(url.parse(req.url).pathname+" is sent");
		res.sendfile("." + pathname);

	} else {
		res.redirect("/loginUserForm");
	}
};
